<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="{$_C.hy_path}css/detail/default.css" />
		<link rel="stylesheet" type="text/css" href="{$_C.hy_path}css/detail/component.css" />
		<link rel="stylesheet" type="text/css" href="{$_C.hy_path}css/amazeui.min.css"/>
		<link rel="stylesheet" type="text/css" href="{$_C.hy_path}css/hy.admin.css"/>
		<script src="{$_C.hy_path}js/detail/modernizr.custom.js"></script>
		
	</head>
	<body>
		<div class="am-g">
			 {include file='../Common/hy_header.html'}
			 	<p style="color:red;">请上传的路径是带http://,否则访问会出错</p>
      <div class="am-u-sm-12">
        <div class="am-form">
          <table class="am-table am-table-striped am-table-hover hy-table-main">
            <thead>
              <tr>
                <th class="table-title" width="10%">位置</th>
                <th class="table-type" width="35%">路径</th>
                <th class="table-date" width="35%">图片替换路径</th>
                <th class="table-set" width="20%">操作</th>
              </tr>
          </thead>
          <tbody>
          	{foreach from=$home_list item=keyword}
            <tr>
              <td>{$keyword.place}号位置</td>
              <td ><div style="width:400px;word-wrap: break-word;">{$keyword.url}</div></td>
              <td>{$keyword.cdn}</td>
              <td>
                <div class="am-btn-toolbar">
                  <div class="am-btn-group am-btn-group-xs">
                    <button data-id="{$keyword.id}" data-keyword="{$keyword.url}" data-modal="modal-1"  class="am-btn am-btn-default am-btn-xs am-text-secondary md-trigger "><span class="am-icon-pencil-square-o"></span> 编辑</button>
                  </div>
                </div>
              </td>
            </tr>
             {/foreach} 
          </tbody>
        </table>
          <div class="am-cf">

  <div class="am-fr">
  {$user_list_page}
  </div>
</div>
          <hr />
      
        </div>
      </div>

    </div>
    </div>
   {include file='../Common/hy_footer.html'}
   <div class="md-modal md-effect-1" id="modal-1">
			<div class="md-content">
				<h3>编辑路径</h3>
				<div>
					<table>
						<tr>
							<td><strong>路径:</strong></td>
							<td><input value = "" name="keyword" id="keyword" ></input></td>
						</tr>
					</table>
					<div style="height:10px;"></div>
					<div>
						<input value="" name="id" id="id" type="hidden"></input>
					<button onclick="saveKeyword()" style="float: left;margin-left: 65px;">保存</button>
					<button style="	float: right;margin-right: 47px;" class="md-close">关闭</button>
					</div>
				</div>
			</div>
		</div>
   <div class="md-overlay"></div>
		<script src="{$_C.hy_path}js/detail/classie.js"></script>
		<script src="{$_C.hy_path}js/detail/modalEffects.js"></script>
		<script>
			// this is important for IEs
			var polyfilter_scriptpath = '{$_C.hy_path}js/detail/';
		</script>
		<script src="{$_C.hy_path}js/detail/cssParser.js"></script>
		<script src="{$_C.hy_path}js/detail/css-filters-polyfill.js"></script>
		<script type="text/javascript">
			function saveKeyword(){
				var url="/ws/index.php?g=admin&m=npc&a=updateUrl";
				var id = $("#id").val();
				var keyword = $("#keyword").val();
				if(keyword==""||keyword==undefined||keyword==null){
					alert("请填写路径");
					return false;
				}
				var data = {
					"id":id,
					"url":keyword
				}
				$.post(url,data,function(res){
					console.info(res);
					if(res.error==0){
						$("#id").val("");
						$("#keyword").val("");
						$(".md-close").click();
						showMsg("成功保存",0);
						window.location.href="/ws/index.php?g=admin&m=npc&a=home";
					}else{
						showMsg(res.content,1);
					}
				},"json")
				
			}
		</script>
	</body>
</html>
